﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Text;

namespace MQ.Core.Util
{
    public class FileHelper
    {
        /// <summary>
        /// 获取AppDomain.CurrentDomain.BaseDirectory绝对路径
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public static string GetAbsolutePath(string path)
        {
            return AppDomain.CurrentDomain.BaseDirectory + path;
        }
        /// <summary>
        /// 创建文件
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public static FileStream CreateFile(string path)
        {
            return File.Create(path);
        }
        /// <summary>
        /// 文件是否存在
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public static bool Exists(string path)
        {
            return File.Exists(path);
        }
        /// <summary>
        /// 获得文件扩展名
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public static string GetExtension(string name)
        {
            return Path.GetExtension(name);
        }

        //public static byte[] Read(string path)
        //{
        //    if (Exists(path))
        //    {
        //        FileStream fs = File.Open(path, FileMode.OpenOrCreate, FileAccess.Read);
        //        fs.r
        //    }
        //}
    }
}
